<template>
  <div>3-1</div>
</template>

<script>
import axios from "axios";
// Axios 实例创建  不创建则使用的默认实例
export default {
  name: "axios3-1",
  created() {
    //   axios.create() 创建实例
    let instance = axios.created({
      baseURL: "http//localhost:8080",
      timeout: 1000,
    });
    let instance2 = axios.create({
      baseURL: "http://localhost:8181",
      timeout: 2000,
    });
    instance.get("/data.json").then((res) => {
      console.log(res);
    });
    axios.get("/data.json").then((res) => {
      console.log(res);
    });
    instance2.get("/data.json").then((res) => {
      console.log(res);
    });
  },
};
</script>

<style>
</style>